package com.warehouse.management.models;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * The persistent class for the orders database table.
 * 
 */
@Entity
@Table(name = "orders")
@NamedQuery(name = "Order.findAll", query = "SELECT o FROM Order o")
public class Order implements Serializable {

    private static final long serialVersionUID = 8275322700173302550L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(unique = true, nullable = false)
    private int orderId;

    @Lob
    @Column(nullable = false)
    private String orderDescription;

    @Column(nullable = false, precision = 10, scale = 2)
    private BigDecimal orderPrice;

    @Column(nullable = false, precision = 10, scale = 2)
    private BigDecimal pricePerItem;

    @Column(nullable = false)
    private int quantity;

    // bi-directional many-to-one association to Client
    @ManyToOne
    @JoinColumn(name = "ClientId", nullable = false)
    private Client client;

    public Order() {
    }

    public int getOrderId() {
	return this.orderId;
    }

    public void setOrderId(int orderId) {
	this.orderId = orderId;
    }

    public String getOrderDescription() {
	return this.orderDescription;
    }

    public void setOrderDescription(String orderDescription) {
	this.orderDescription = orderDescription;
    }

    public BigDecimal getOrderPrice() {
	return this.orderPrice;
    }

    public void setOrderPrice(BigDecimal orderPrice) {
	this.orderPrice = orderPrice;
    }

    public BigDecimal getPricePerItem() {
	return this.pricePerItem;
    }

    public void setPricePerItem(BigDecimal pricePerItem) {
	this.pricePerItem = pricePerItem;
    }

    public int getQuantity() {
	return this.quantity;
    }

    public void setQuantity(int quantity) {
	this.quantity = quantity;
    }

    public Client getClient() {
	return this.client;
    }

    public void setClient(Client client) {
	this.client = client;
    }

}